#ifndef   GAME_UTILITY_HY
#define   GAME_UTILITY_HY


#include "gMatrix.h"

#define    _RGB32BIT(a,r,g,b)   (b+(g<<8)+(r<<16)+(a<<24))
#define    RGB32(r,g,b)         _RGB32BIT(255,r,g,b)

class Utility 
{
public:
	static int abs(int x);
	// convert color from ARGB 4444 format in a short to ARGB 8888 format in an int
	static int RGB4444to8888(short color);
	static int log2(int n);
	static int limit(int num, int min, int max);
	//static int random(int min, int max);
	static int fastDistance(int x, int y);
	static int slowDistance(int dx, int dy);
	static int verySlowDistance(int dx, int dy);
	/**
	* Cacualte square root for a positive integer with 8-bits floating point
	* @param n int - Positive integer to be caculated with 8-bits floating point
	* @return int - Positive integer with 8-bits floating point
	*/
	static int squareRoot(int n);
};
//----------------------------------------------------------------------------
class CMath
{
public:
	float mySin[361];
	float myCos[361];

	CMath();
	~CMath();
	void GetSinCos();
};
#endif